package com.example.milimili;

import androidx.annotation.DrawableRes;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class TabChooseActivity extends AppCompatActivity {
//    娱乐、军事、教育、文化、健康、财经、体育、汽车、科技、社会
    private Button yuleBtn,junshiBtn,jiaoyuBtn,wenhuaBtn,jiankangBtn,caijingBtn,tiyuBtn,qicheBtn,kejiBtn,shehuiBtn,cancelBtn,confirmBtn;
    private boolean[] tabBoolList=new boolean[15];

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tab_choose);
        initView();
    }

    private void initView() {
        for(int i=0;i<15;i++)
        {
            tabBoolList[i]=false;
        }
        yuleBtn=findViewById(R.id.yule);
        yuleBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[0]=true;
            }
        });
        junshiBtn=findViewById(R.id.junshi);
        junshiBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[1]=true;
            }
        });
        jiaoyuBtn=findViewById(R.id.jiaoyu);
        jiaoyuBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[2]=true;
            }
        });
        wenhuaBtn=findViewById(R.id.wenhua);
        wenhuaBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[3]=true;
            }
        });
        jiankangBtn=findViewById(R.id.jiankang);
        jiankangBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[4]=true;
            }
        });
        caijingBtn=findViewById(R.id.caijing);
        caijingBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[5]=true;
            }
        });
        tiyuBtn=findViewById(R.id.tiyu);
        tiyuBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[6]=true;
            }
        });
        qicheBtn=findViewById(R.id.qiche);
        qicheBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[7]=true;
            }
        });
        kejiBtn=findViewById(R.id.keji);
        kejiBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[8]=true;
            }
        });
        shehuiBtn=findViewById(R.id.shehui);
        shehuiBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tabBoolList[9]=true;
            }
        });
        cancelBtn=findViewById(R.id.cancel);
        cancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(TabChooseActivity.this,MainActivity.class);
                TabChooseActivity.this.startActivity(intent);
            }
        });
        confirmBtn=findViewById(R.id.confirm);
        confirmBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                for(int i=0;i<10;i++)
                {
                    FragmentAdapter.tabBoolList[i]=tabBoolList[i];
                }
                Intent intent=new Intent(TabChooseActivity.this,MainActivity.class);
                TabChooseActivity.this.startActivity(intent);
            }
        });
    }
}